package com.sihan.swvp.sync.task;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import com.sihan.swvp.common.CommonUtil;

public class Fmp {
	
	private String type;
	private String field;
	private String format;
	
	
	public Object trans(Object raw){
		switch (type) {
		case "DATE":
			return CommonUtil.o2date(raw, format);
		case "LONGDATE":
			Calendar cal = Calendar.getInstance();  
			cal.setTimeInMillis((long) raw);  
			Date date = cal.getTime();  
			SimpleDateFormat sdf = new SimpleDateFormat(format);
			return CommonUtil.o2date(sdf.format(date));
		default:
			return raw;
		}
	}
	
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getField() {
		return field;
	}
	public void setField(String field) {
		this.field = field;
	}
	public String getFormat() {
		return format;
	}
	public void setFormat(String format) {
		this.format = format;
	}
}
